package manaul;
import edu.princeton.cs.algs4.StdDraw;
import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
public class C1_28 {

	public static int rank(int key, int[] a)
	{ // 数组必须是有序的
	int lo = 0;
	int hi = a.length - 1;
	while (lo <= hi)
	{ // 被查找的键要么不存在，要么必然存在于a[lo..hi] 之中
	int mid = lo + (hi - lo) / 2;
	if (key < a[mid]) hi = mid - 1;
	else if (key > a[mid]) lo = mid + 1;
	else {a[mid]=0;
		return mid;}
	}
	return -1;
	}
	/*public static void insert(ArrayList<Integer>a,int key) {
		a[a.length]=key;
	}*/
	public static void main(String[] args)
	{
	/*int[] whitelist = { 1, 2, 3,3,4, 4, 6, 7, 8, 9, 12 };
	ArrayList<Integer>result = new ArrayList<Integer>();
	for(int i:whitelist)
	StdOut.print(i+" ");
	StdOut.print("\n");
	Arrays.sort(whitelist);
	for(int i:whitelist)	
	{
		int nothing=rank(i, whitelist);
		if (rank(i, whitelist)==-1) 
			result.add(i);		
	}
	for(int q:result)
		StdOut.print(q+" ");
		*/
	int N=StdIn.readInt();
	Double p=StdIn.readDouble();
	double x=0.5;
	double y=0.5;
	double radius=0.2;
	StdDraw.circle(x, y, radius);
	double[][] pos=new double[2][N];
	for (int i = 0; i < N; i++) {
		pos[0][i]=y+Math.sin(i*2*Math.PI/N)*radius;
		pos[1][i]=x+Math.cos(i*2*Math.PI/N)*radius;	
		}
	for (int i = 0; i < N; i++) {
		StdDraw.circle(pos[1][i], pos[0][i], 0.05);
	}
	double[][] posibility=new double[N][N];
	Random r = new Random();
		for (int i = 0; i < N; i++) {
			for (int j = i+1; j < N-1; j++) {
				double q=r.nextDouble();
				if (q>0.1) {
					posibility[i][j]=1;
					posibility[j][i]=1;
					StdDraw.line(pos[1][i], pos[0][i], pos[1][j], pos[0][j]);
				}
				else {
					posibility[i][j]=0;
					posibility[j][i]=0;
				}
				
			}
			
		}

	}
	}
	
	

